package com.pfzy.utildemo.activity.im;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.pfzy.utildemo.ConstsValue;
import com.pfzy.utildemo.R;

import org.jetbrains.annotations.NotNull;

import java.util.List;

public class MessageListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
    private Context mContext;
    private List<Message> list;

    public MessageListAdapter(Context context, List<Message> list) {
        this.list = list;
        this.mContext = context;
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        if (viewType == ConstsValue.MESSAGE_TYPE_SEND) {// 类型 标题
            View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_send_message_title, parent, false);
            return new TitleViewHolder(view);
        } else if (viewType == ConstsValue.MESSAGE_TYPE_RECEIVE) {// 类型 内容
            View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_send_message_des, parent, false);
            return new ContentViewHolder(view);
        }
        return null;
    }

    @Override
    public void onBindViewHolder(@NonNull @NotNull RecyclerView.ViewHolder holder, int position) {
        if (getItemViewType(position) == ConstsValue.MESSAGE_TYPE_SEND) {
        }
    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    public class TitleViewHolder extends RecyclerView.ViewHolder {
        public TextView tvTitle;
        public TitleViewHolder(View view) {
            super(view);
//            tvTitle = (TextView) itemView.findViewById(R.id.tv_adapter_assess_summary_title);
        }
    }

    public class ContentViewHolder extends RecyclerView.ViewHolder {
//        public TextView tvtitle2;
        public ContentViewHolder(View itemView) {
            super(itemView);
//            tvtitle2 = (TextView) itemView.findViewById(R.id.tv_adapter_assess_summary_title2);
        }
    }
}
